import Roact from '@rbxts/roact';
import { container } from 'shared/component/container/ContainerService';
import BaseComponent from 'shared/component/dlt-view/BaseComponent';
import { CSS } from 'shared/component/dlt-view/CssCommon';
export interface TestViewProps {
    name?: StringValue
}
export class TestView extends Roact.Component<TestViewProps> {
    binder = new BaseComponent<TestViewProps>()
    protected willUnmount(): void {
        this.binder.willUnmount();
    }
    constructor(props: TestViewProps) {
        super(props);
        this.binder.bind(['name'], props, () => this.setState(props));
    }
    public render(): Roact.Element | undefined {
        const children = new Array<Roact.Element>();
        this.props[Roact.Children]?.forEach(c => {
            children.push(c)
        })
        const t = new CSS();
        const s = (name: string) => t.cssEx(name);
        const r = <Roact.Fragment>
            <frame {...s('test')} Key={'test'}>
                <frame {...s('Frame')} Key={'Frame'}>
                    <textlabel {...s('TextLabel')} Key={'TextLabel'}>
                    </textlabel>
                    <textbutton {...s('TextButton')} Key={'TextButton'} Text={'I donot have css'} Event={{
                        Activated: () => {
                            container.getService('testService')?.test({
                                test: "I test now"
                            }, {
                                player: game.GetService('Players').LocalPlayer
                            })
                        }
                    }}>
                    </textbutton>
                </frame>
            </frame>
        </Roact.Fragment>;
        return r
    }

}